[Tests] Add attentions_option to ModelTesterMixin#15909
Merged
NielsRogge merged 3 commits intohuggingface:masterfrom Mar 10, 2022
Merged
[Tests] Add attentions_option to ModelTesterMixin#15909NielsRogge merged 3 commits intohuggingface:masterfrom
NielsRogge merged 3 commits intohuggingface:masterfrom
Conversation
|
The documentation is not available anymore as the PR was closed or merged. |
LysandreJik
approved these changes
Mar 8, 2022
Member
LysandreJik
left a comment
There was a problem hiding this comment.
LGTM, thank you @NielsRogge
Pinging @ydshieh as well for second review
Member
|
You'll need to fix the failing tests as well. |
Collaborator
|
Thanks for this work @NielsRogge ! I left a review comment (question) about And then a minor question here: It is a bit strange (to me) to have |
NielsRogge
commented
Mar 8, 2022
Contributor
Author
|
@LysandreJik I've fixed the failing tests, failing test seems unrelated |
Member
|
Feel free to merge if every test passes after a rebase |
2192fef to
904d957
Compare
This was referenced Mar 18, 2022
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
The library is called HuggingFace Transformers, I know.. but we recently have additions of non-Transformer based models, that don't use attention (namely ConvNeXT and PoolFormer). Soon, we'll also have ResNet in the library (which will back Transformer-based models such as DETR).
As these models don't use attention, they need to overwrite 3 tests:
test_attention_outputstest_retain_grad_hidden_states_attentionstest_model_outputs_equivalenceThis PR adds a
has_attentionsattribute toModelTesterMixinwhich can be set to False for such models. It will then make sure these tests are properly tested, without taking into account attention.